<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="app">
        <ul>
            <li><a href="#" @click="num='one'">1</a></li>
            <li><a href="#" @click="num='two'">2</a></li>
            <li><a href="#" @click="num='three'">3</a></li>
            <li><a href="#" @click="num='four'">4</a></li>
        </ul>
        <component :is="num"></component>
    </div>

    

    <script>
        Vue.component('one',{
            template: `<div>1</div>`,
        })
        Vue.component('two',{
            template: `<div>2</div>`,
        })
        Vue.component('three',{
            template: `<div>3</div>`,
        })
        Vue.component('four',{
            template: `<div>4</div>`,
        })

        var vm = new Vue({
            el: '#app',
            data: {
                num: '',
            },
            methods: {}
        });
    </script>
</body>

</html>